<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use App\Models\Cabinet;
use App\Models\CabinetAlarmLog;
use App\Models\SwitchData;
use App\Models\SwitchElectric;
use App\Models\DedustingDevice;
use App\Models\DedustingDeviceData;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        //
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        //电源柜报警
        // CabinetAlarmLog::setAlarm();
        //宏发开关相关
        // SwitchData::getDataFromRedis();
        // SwitchElectric::addTodayElectric();
        // $schedule->command('inspire')
        //          ->hourly();
        
        $schedule->call(function () {
            //除尘小程序 在线离线 运行时长
            DedustingDevice::statusAndAlive();
            //除尘小程序 数据入库
            DedustingDeviceData::setDbData();
        })->everyMinute();
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}
